﻿IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'P_GetUserEnterpriseNames')
	BEGIN
		DROP  Procedure  [esf_sso].P_GetUserEnterpriseNames
	END

GO

CREATE Procedure [esf_sso].P_GetUserEnterpriseNames
AS
	SELECT
		DISTINCT P.OtherEnterprise AS Ent_Name
	FROM
		esf_sso.Person P
	WHERE
		P.OtherEnterprise IS NOT NULL
	UNION ALL
	SELECT
		VE.Ent_Name
	FROM
		esf_sso.VEnterprise VE 